<?php 

function validate_waktu($waktu){
	$htime = explode( ":" , $waktu );
	if((int) $htime[0] > 23 )return false;
	if((int) $htime[0] < 0 )return false;
	if((int) $htime[1] > 59 )return false;
	if((int) $htime[1] < 0 )return false;
	return true;
}

function validate_birthdate($date){
	list($yyyy , $mm, $dd) = explode( "-" , $date );
	if(!checkdate($mm , $dd ,$yyyy))return (-3);
	
	if(getage($date) < 18 )return (-2);
	$time_date = mktime( 0, 0, 0, $mm, $dd, $yyyy );
	$minimum_time = time() - 31 * 12 * 18 * 84600  ;
	if($time_date < $minimum_time)return (-1);
	
	return 1;
}  

function view_waktu_format($jam_time){
 
	if(trim($jam_time) =='')return "00:00";
	if(trim($jam_time) =='-')return "00:00";
	if(trim($jam_time) =='00:00:00')return "00:00";
	$htime = explode(":" , $jam_time);
	if(count($htime) == 1 )return false;
	return $htime[0].":".$htime[1];
}


function urutan_kalendar_usaha($dd){
	if($dd > 20){
		return $dd-11;
	}
	return $dd + 10;
}